package com.jf.es.sql.jdbc;

import org.elasticsearch.xpack.sql.jdbc.EsDataSource;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.sql.DataSource;
import java.util.Properties;

@Configuration
public class EsDataSourceConfig {

    @Bean("EsDataSource")
    public DataSource esDataSourceConfig(){
        final EsDataSource esDataSource = new EsDataSource();
        esDataSource.setUrl("jdbc:es://http://180.76.150.245:9200");

        Properties properties = new Properties();
        properties.put("user", "elastic");
        properties.put("password", "C8a=ZunSo47uyeaKCM6y");
        esDataSource.setProperties(properties);
        return esDataSource;
    }

}
